<html>
<head>
<script type="text/javascript" src="<?php echo base_url()?>js/jquery.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>js/jquery-ui.js"></script>
<script type="text/javascript" src="<?php echo base_url()?>js/jquery.timeago.js"></script>
<script type="text/javascript">
$(document).ready(function() {
	 jQuery(".time").timeago();
	
	$('.delete_update<?php echo $add;?>').click(function() 
	{
		var item = $(this);
		var $konfirmasi = $("<div></div>" )
			.html('Are you sure want to delete this comment?')
			.dialog({
				title: 'Delete Comment Place',
				autoOpen: false,
				resizable: false,
				height:140,
				modal: true,
				buttons: {
					"Yes": function() {
						$.ajax({
							type: "POST",
							url: "http://localhost/ta/place/del_com",
							data: $.param({id_comment:item.attr("del_id")}),
							cache: false,
							success: function(html){
								$("#row_"+item.attr("del_id")).slideUp('slow', function() {$(this).remove();});
							}
						});
						$( this ).dialog( "close" );
					},
					"No": function() {
						$( this ).dialog( "close" );
					}
				}
			});	
		$konfirmasi.dialog('open');
		return false;
	});
});
</script>
</head>
<body>	
<div id="main_content">
<ol style="list-style-type:none" id="update" class="timeline">

<?php foreach($latest_comments as $komen):?>
<li id="row_<?php echo $komen->id_comment;?>">
<div id="newpost">
	<?php echo '<div class="photo" title="'.$komen->username.'">';?>
	<?php 	if ($komen->avatar == 0 || $komen->avatar == null){
				if ($komen->id_user == $this->session->userdata('id_user')){
					echo anchor('profile',img($def));
				}
			}else 
				if ($komen->id_user == $this->session->userdata('id_user')){
					echo anchor('profile',img(array('src'=>'img/thumb_foto/'.$komen->filename,'width'=>50,'height'=>50)));
				}
	echo '</div>';
				if ($komen->id_user == $this->session->userdata('id_user')){
					echo '<div class="username"><b>'.anchor('profile',$komen->username).'</b></div>';
					echo '<div class="kotakstatus3"><div class="status2">'.$komen->content;
					echo '</div>';
					echo '<div class="time" title="'.$komen->created.'"></div>';
					echo '<div class="action"><span class="delete_button"><a href="#" del_id="'.$komen->id_comment.'" class="delete_update'.$add.'"><img src="http://localhost/ta/img/delete.gif"/>Delete</a></span></div>';
					echo '</div>';	
					echo '<div class="clear"></div>';
			
				}				
		?>	
		
</div>
</li>
<?php endforeach;?>
</ol>
</div>
</body>
</html>